import { request } from "@/utils/request";

/**
 * 根据商户id获取关联报表list
 * @returns {promise} Promise
 */
export async function dataBoardReportList(data) {
  let res = await request(
    '/report/merchant/reported/merReMenuById',
    data
  )
  return res;
}

/**
 * 根据商户id获取菜单
 * @returns {promise} Promise
 */
export async function dataBoardReportMenuList(data) {
  let res = await request(
    '/report/merchant/reportmenu/merReMenuById',
    data
  )
  return res;
}

/**
 * 根据机构id获取菜单
 * @returns {promise} Promise
 */
export async function dataBoardReportMerReMenuInsById(data) {
  let res = await request(
    '/report/merchant/reportmenu/merReMenuInsById',
    data
  )
  return res;
}

/**
 * 机构树  --
 * @returns {promise} Promise
 */
export async function merchantInsQueryTree(data) {
  let res = await request(
    '/merchant/merchantIns/authIns',
    data
  )
  return res;
}

/**
 * 根据菜单id获取全部图表
 * @returns {promise} Promise
 */
export async function dataBoardByReportMenuId(data) {
  let res = await request(
    '/report/merchant/chart/byReportMenuId',
    data
  )
  return res;
}

/**
 * 新增图表
 * @returns {promise} Promise
 */
export async function dataBoardInsertChart(data) {
  let res = await request(
    '/report/merchant/chart/insertChart',
    data
  )
  return res;
}

/**
 * 根据图表id获取表头数据详情
 * @returns {promise} Promise
 */
export async function dataBoardByChartId(data) {
  let res = await request(
    '/report/merchant/chart/byChartId',
    data
  )
  return res;
}

/**
 * 根据图表id获取表头数据详情
 * @returns {promise} Promise
 */
export async function dataBoardGetChatData(data) {
  let res = await request(
    '/report/merchant/chart/getChatData',
    data
  )
  return res;
}


/**
 * 编辑图表
 * @returns {promise} Promise
 */
export async function dataBoardUpdateChart(data) {
  let res = await request(
    '/report/merchant/chart/updateMerChart',
    data
  )
  return res;
}

/**
 * 根据图表id删除
 * @returns {promise} Promise
 */
export async function dataBoardDeleteChartById(data) {
  let res = await request(
    '/report/merchant/chart/deleteChartById',
    data
  )
  return res;
}

/**
 * 保存图表位置更新
 * @returns {promise} Promise
 */
export async function dataBoardReserveChart(data) {
  let res = await request(
    '/report/merchant/chart/reserveChart',
    data
  )
  return res;
}

/**
 * 保存图表位置更新
 * @returns {promise} Promise
 */
export async function dataBoardMerchantGetChatData(data) {
  let res = await request(
    '/report/merchant/chart/getChatData',
    data
  )
  return res;
}

/**
 * 导出图表
 * @returns {promise} Promise
 */
export async function dataBoardChartExport(data) {
  let res = await request(
    '/report/chart/export',
    data,
  )
  return res;
}


// 分配商户模块接口API

/**
 * 根据机构id获取所有菜单
 * @returns {promise} Promise
 */
export async function merchantReportmenuMerReMenuById(data) {
  let res = await request(
    '/report/merchant/reportmenu/merReMenuById',
    data
  )
  return res;
}

/**
 * 根据机构id获取所有报表 (弃用)
 * @returns {promise} Promise
 */
export async function merchantReportedMerReMenuById(data) {
  let res = await request(
    '/report/merchant/reported/merReMenuById',
    data
  )
  return res;
}

/**
 * 分配商户菜单\报表
 * @returns {promise} Promise
 */
export async function merchantReportmenuOperate(data) {
  let res = await request(
    '/report/merchant/reportmenu/operate',
    data
  )
  return res;
}

/**
 * 排行饼图数据请求
 * @returns {promise} Promise
 */
export async function merchantReportGetChartDataSort(data) {
  let res = await request(
    '/report/merchant/chart/getChatDataSort',
    data
  )
  return res;
}

// ============================= 新建看板/分组 ======================

/**
 * 新增分组
 * @returns {promise} Promise
 */
export async function merchantReportInsertMerReMenu(data) {
  let res = await request(
    '/report/merchant/reportmenu/insertMerReMenu',
    data
  )
  return res;
}

/**
 * 新增看板
 * @returns {promise} Promise
 */
export async function merchantReportInsertSubMerReMenu(data) {
  let res = await request(
    'report/merchant/reportmenu/insertSubMerReMenu',
    data
  )
  return res;
}

/**
 * 获取看板数据
 * @returns {promise} Promise
 */
export async function merchantReportQueryMenu(data) {
  let res = await request(
    'report/merchant/reportmenu/queryMenu',
    data
  )
  return res;
}

/**
 * 更新看板数据
 * @returns {promise} Promise
 */
export async function merchantReportUpdateSubMerMenu(data) {
  let res = await request(
    'report/merchant/reportmenu/updateSubMerMenu',
    data
  )
  return res;
}

/**
 * 删除分组
 * @returns {promise} Promise
 */
export async function merchantReportRemoveMerMenu(data) {
  let res = await request(
    '/report/merchant/reportmenu/removeMerMenu',
    data
  )
  return res;
}

/**
 * 删除看板
 * @returns {promise} Promise
 */
export async function merchantReportmenuRemoveSubMerMenu(data) {
  let res = await request(
    'report/merchant/reportmenu/removeSubMerMenu',
    data
  )
  return res;
}

// 新版本接口 ---------------- //

/**
 * 获取所有图表信息
 * @returns {promise} Promise
 */
export async function merchantReportProvideSel(data) {
  let res = await request(
    'report/provide/sel',
    data
  )
  return res;
}
/**
 * 获取单个活动图表信息
 * @returns {promise} Promise
 */
export async function merchantReportProvideSelSingle(data) {
  let res = await request(
    'report/provide/singleSel',
    data
  )
  return res;
}


/**
 * 获取单个图表数据
 * @returns {promise} Promise
 */
export async function merchantReportQueryData(data) {
  let res = await request(
    'report/query/queryData',
    data
  )
  return res;
}

/**
 * 获取条件数据
 * @returns {promise} Promise
 */
export async function merchantReportQueryCondition(data) {
  let res = await request(
    'report/query/queryCondition',
    data
  )
  return res;
}

/**
 * 保存数据
 * @returns {promise} Promise
 */
export async function merchantReportProvideUpda(data) {
  let res = await request(
    'report/provide/upda',
    data
  )
  return res;
}
/**
 * 保存单个活动报表数据
 * @returns {promise} Promise
 */
export async function merchantReportProvideUpdateSingle(data) {
  let res = await request(
    '/report/provide/updateSingle',
    data
  )
  return res;
}
